package leetcode.数组;

public class 移动零283 {
    public static void moveZeroes(int[] nums) {
        int length = nums.length;
        int count = 0;
        for (int i = 0; i < length; i++) {
            if(nums[i] == 0 && i < length-count){
                for(int j = i;j < length - 1;j++){
                    nums[j] = nums[j+1];
                }
                count++;
                nums[length-1] = 0;
                i--;
            }
        }

    }

    public static void main(String[] args) {
        int[] nums = {0,1,0,3,12};
        moveZeroes(nums);
    }
}
